package com.example.demo.utils;

public class ThreadUtil extends Thread {
    public ThreadUtil(String name) {
        super(name);//未当前线程设置名字
    }
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println("子线程" + Thread.currentThread().getName() + ":" + i);
            if (i == 5) {
                try {
                    //项目经理让我加上这行代码，如果用户交钱了，就注释掉
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }
}
